﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;

namespace ASPNETVN.PORTAL.Modules.ACTP.Components
{
    public partial class Team
    {
        public static IList<Team> SelectCollectionBy_EmployeeID(Guid moduleID, int employeeID)
        {
            const string spName = "p_ACTP_Team_SelectBy_EmployeeID";
            SqlDatabase db = (SqlDatabase)DatabaseFactory.CreateDatabase();
            SqlCommand dbCommand = (SqlCommand)db.GetStoredProcCommand(spName);

            db.AddInParameter(dbCommand, "@ModuleID", SqlDbType.UniqueIdentifier, moduleID);
            db.AddInParameter(dbCommand, "@EmployeeID", SqlDbType.Int, employeeID);

            IDataReader reader = db.ExecuteReader(dbCommand);
            return ConvertToCollection(reader);
        }
    }
}
